<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

<ui:composition template="/templates/modeloGeral.xhtml">
<ui:define name="metadata">
		<f:metadata>
		<f:viewParam name="servacao" value="#{servicosBean.acao}"/>
		<f:viewParam name="servcod" value="#{servicosBean.codigo}"/>
		
			<f:event listener="#{servicosBean.carregarCadastro}" type="preRenderView" />
		</f:metadata>
	</ui:define>

	<ui:define name="conteudo">

		<h:form id="frmSerCad">
			<p:toolbar>
				<f:facet name="left">
					<h:outputText value="Serviços" />
				</f:facet>
			</p:toolbar>
			<h:panelGrid id="pnlSerCadDados" columns="2">
			
				<p:outputLabel value="Código" />
				<p:inputText size="10" readonly="true" value="#{servicosBean.servicosCadastro.id}" />
				

				<p:outputLabel value="Tipo" />
				<p:inputText maxlength="20" size="10" value= "#{servicosBean.servicosCadastro.tipo}" 
				readonly="#{servicosBean.acao == 'Excluir'}">
				<f:validateBean />
				</p:inputText>
			</h:panelGrid>
			<h:panelGrid columns="3">
			<p:commandButton value="Novo" actionListener="#{servicosBean.novo}" update=":frmSerCad:pnlSerCadDados" 
			rendered="#{servicosBean.acao == 'Novo' and autenticacaoBean.funcionarioLogado.funcao != 'Atendente'}"/>
			<p:commandButton value="Salvar" actionListener="#{servicosBean.salvar}" update=":msgGlobal :frmSerCad:pnlSerCadDados"
			rendered="#{servicosBean.acao == 'Novo'and autenticacaoBean.funcionarioLogado.funcao != 'Atendente'}"/>
			<p:commandButton value="Excluir" actionListener="#{servicosBean.excluir}"  update=":msgGlobal" 
			rendered="#{servicosBean.acao == 'Excluir' and autenticacaoBean.funcionarioLogado.funcao != 'Atendente'}"/>
			<p:commandButton value="Editar" actionListener="#{servicosBean.editar}"  update=":msgGlobal" 
			rendered="#{servicosBean.acao == 'Editar' and autenticacaoBean.funcionarioLogado.funcao != 'Atendente'}"/>
			<p:button value="Voltar" outcome="/pages/servicosPesquisa.xhtml?faces-redirect=true"/>
			
			</h:panelGrid>
			
		</h:form>
	</ui:define>
</ui:composition>

</html>